import { FormDialog } from '@/components/formDialog/index2'
import messageBox401 from '@/utils/messageBox401/messageBox401.vue'
import { getToken, remoteAllCookies } from '@/utils/auth'
import Cookies from 'js-cookie'

var triggerMessageBox401_id = 'triggerMessageBox401_id'

export async function triggerMessageBox401() {
  /*  if(getToken()){
  
    }else{
    return Promise.resolve()
    }*/
  
  FormDialog.close(triggerMessageBox401_id)
  remoteAllCookies()
  return FormDialog({
    uuid: triggerMessageBox401_id,
    title: '检查登录过期，请重新登录',
    hiddenFooter: true,
    closeOnClickModal: false,
    marginTop: '25vh',
    width: '660px',
    sureText: '登录',
    components: {
      modify: messageBox401
    }
  }).then(res=>{
    console.log("=>(messageBox401.js:29) then", res);
    Cookies.set('SINGLE_403_ALERT', '')
    return Promise.resolve(res)
  })
    .catch(e => {
      console.log('=>(messageBox401.js:29) finally')
      Cookies.set('SINGLE_403_ALERT', '')
      return Promise.reject(e)
    })
  
}
